
package wuziqi;
// 游戏状态
class GameState {
    private char[][] board;
    private char currentPlayer;
    private int moveCount;
    // 记录当前玩家最后的下棋位置，方便检查是否胜利。
    private int lastMoveRow = -1;
    private int lastMoveCol = -1;
    
    public GameState(int size, char emptySymbol) {
        board = new char[size][size];
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                board[i][j] = emptySymbol;
            }
        }
        currentPlayer = 'X';
        moveCount = 0;
    }
    
    // Getters and setters
    public char[][] getBoard() { return board; }
    public char getCurrentPlayer() { return currentPlayer; }
    public void setCurrentPlayer(char player) { this.currentPlayer = player; }
    public int getMoveCount() { return moveCount; }
    public void incrementMoveCount() { moveCount++; }
    
    public int getLastMoveRow() { return lastMoveRow; }
    public int getLastMoveCol() { return lastMoveCol; }
    public void setLastMove(int row, int col) { 
        this.lastMoveRow = row; 
        this.lastMoveCol = col; 
    }
}
